/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.itcast;

/**
 * <p>Project: JavaStudy - For2
 * <p>Powered by jiangbo On 2023-02-25
 * 11:27:35
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class For2 {
    public static void main(String[] args) {
        //100以内相加
        int sum=0;
        for (int i=1;i<=100;i++){
            sum=sum+i;
        }
        System.out.println(sum);
        System.out.printf("1+2+3+...+100 = %d%n",sum);
        System.out.printf("1+2+3+...+100 = \033[32m%d\033[0m%n", sum);
    }
}


